jgy-public-component 0.0.45 → 0.0.47

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 (30) hide show
  1. package/README.md +4 -1
  2. package/dist/components/JApprovalFlow/JApprovalAddSignDialog.d.ts +28 -0
  3. package/dist/components/JApprovalFlow/JApprovalAuditDialog.d.ts +26 -0
  4. package/dist/components/JApprovalFlow/JApprovalFlow.d.ts +57 -0
  5. package/dist/components/JApprovalFlow/JApprovalReturnDialog.d.ts +28 -0
  6. package/dist/components/JApprovalFlow/JApprovalTransferDialog.d.ts +28 -0
  7. package/dist/components/JApprovalFlow/apiPaths.d.ts +22 -0
  8. package/dist/components/JApprovalFlow/index.d.ts +2 -0
  9. package/dist/components/JApprovalFlow/useApprovalHttp.d.ts +7 -0
  10. package/dist/components/JDocDetail/index.d.ts +1 -1
  11. package/dist/components/JDocDetail/registry.d.ts +2 -0
  12. package/dist/components/JDocDetail/store.d.ts +1 -1
  13. package/dist/components/JDocDetail/types.d.ts +5 -0
  14. package/dist/components/JImportData/JImportData.d.ts +120 -0
  15. package/dist/components/JImportData/index.d.ts +2 -0
  16. package/dist/components/JImportData/types.d.ts +65 -0
  17. package/dist/components/JImportData/utils.d.ts +49 -0
  18. package/dist/components/JImportExcel/JImportExcel.d.ts +8 -8
  19. package/dist/components/JProductDetail/JProductDetailDialog.d.ts +1 -1
  20. package/dist/components/JProductSelectDialog/JProductSelectDialog.d.ts +2 -2
  21. package/dist/components/JSearchInputDialog/JSearchInputDialog.d.ts +9 -9
  22. package/dist/directives/clickLock.d.ts +5 -0
  23. package/dist/directives/index.d.ts +2 -0
  24. package/dist/index.d.ts +8 -2
  25. package/dist/index.js +14121 -12112
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.umd.cjs +2 -2
  28. package/dist/index.umd.cjs.map +1 -1
  29. package/dist/style.css +1 -1
  30. package/package.json +1 -1
package/README.md CHANGED
@@ -56,10 +56,13 @@ import 'jgy-public-component/dist/style.css'
56
56
  | JProductDetailDialog / JSkuLink | 产品详情 / SKU 链接(需注入 request) |
57
57
  | DocNoLink / DocDetailHost | 单号链接 + 全局单据详情(需 createDocDetail 注册) |
58
58
  | JRelatedDocs | 关联单据子 Tab 容器(需 createRelatedDocs 注入接口) |
59
+ | JApprovalFlow | 审批进度(时间线 + 审核/转审/回退/加签/取消,需注入 request) |
59
60
 
60
61
  工具方法:数据转换、按钮权限、状态条数 / Tabs、`exportStyledExcel` 前端导出 Excel、路由守卫。
61
62
 
62
- > 完整 Props / 事件 / 插槽、业务组件接入步骤与排错,见 [`docs/index.html`](docs/index.html)(可离线打开)。
63
+ > 完整 Props / 事件 / 插槽、业务组件接入步骤与排错,见 [`docs/index.html`](docs/index.html)(可离线打开)。
64
+ > 列表筛选四件套(`JListSearchHeader` / `JRemoteSelect` / `JSupplierCycleSelect` / `JSupplierCycleDisplay`)见 [`docs/JListSearchHeader-JRemoteSelect-JSupplierCycle-使用文档.md`](docs/JListSearchHeader-JRemoteSelect-JSupplierCycle-使用文档.md)。
65
+ > 审批进度 `JApprovalFlow` 见 [`docs/JApprovalFlow-使用文档.md`](docs/JApprovalFlow-使用文档.md)。
63
66
 
64
67
  ### JListSearchHeader 快速示例
65
68
 
@@ -0,0 +1,28 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ visible: boolean;
4
+ processCode: string;
5
+ businessKey: string;
6
+ addSignPrepare?: Record<string, any> | null;
7
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
8
+ success: () => void;
9
+ "update:visible": (value: boolean) => void;
10
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
+ visible: boolean;
12
+ processCode: string;
13
+ businessKey: string;
14
+ addSignPrepare?: Record<string, any> | null;
15
+ }>>> & Readonly<{
16
+ onSuccess?: (() => any) | undefined;
17
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
@@ -0,0 +1,26 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ visible: boolean;
4
+ processCode: string;
5
+ businessKey: string;
6
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
7
+ success: () => void;
8
+ "update:visible": (value: boolean) => void;
9
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
10
+ visible: boolean;
11
+ processCode: string;
12
+ businessKey: string;
13
+ }>>> & Readonly<{
14
+ onSuccess?: (() => any) | undefined;
15
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
16
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
17
+ export default _default;
18
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
19
+ type __VLS_TypePropsToRuntimeProps<T> = {
20
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
21
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
22
+ } : {
23
+ type: PropType<T[K]>;
24
+ required: true;
25
+ };
26
+ };
@@ -0,0 +1,57 @@
1
+ import { DefineComponent, ExtractPropTypes, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<{
3
+ process_code: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ business_key: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ request: {
12
+ type: FunctionConstructor;
13
+ default: null;
14
+ };
15
+ hideHeader: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ }>, {
20
+ logs: Ref<any[], any[]>;
21
+ raw: Ref<any, any>;
22
+ loading: Ref<boolean, boolean>;
23
+ instance: Ref<any, any>;
24
+ fetchLogs: () => Promise<void>;
25
+ fetchInstance: () => Promise<void>;
26
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
27
+ success: (...args: any[]) => void;
28
+ loaded: (...args: any[]) => void;
29
+ error: (...args: any[]) => void;
30
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
31
+ process_code: {
32
+ type: StringConstructor;
33
+ default: string;
34
+ };
35
+ business_key: {
36
+ type: StringConstructor;
37
+ default: string;
38
+ };
39
+ request: {
40
+ type: FunctionConstructor;
41
+ default: null;
42
+ };
43
+ hideHeader: {
44
+ type: BooleanConstructor;
45
+ default: boolean;
46
+ };
47
+ }>> & Readonly<{
48
+ onSuccess?: ((...args: any[]) => any) | undefined;
49
+ onLoaded?: ((...args: any[]) => any) | undefined;
50
+ onError?: ((...args: any[]) => any) | undefined;
51
+ }>, {
52
+ process_code: string;
53
+ business_key: string;
54
+ request: Function;
55
+ hideHeader: boolean;
56
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
57
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ visible: boolean;
4
+ processCode: string;
5
+ businessKey: string;
6
+ returnPrepare?: Record<string, any> | null;
7
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
8
+ success: () => void;
9
+ "update:visible": (value: boolean) => void;
10
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
+ visible: boolean;
12
+ processCode: string;
13
+ businessKey: string;
14
+ returnPrepare?: Record<string, any> | null;
15
+ }>>> & Readonly<{
16
+ onSuccess?: (() => any) | undefined;
17
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
@@ -0,0 +1,28 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ visible: boolean;
4
+ processCode: string;
5
+ businessKey: string;
6
+ transferPrepare?: Record<string, any> | null;
7
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
8
+ success: () => void;
9
+ "update:visible": (value: boolean) => void;
10
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
+ visible: boolean;
12
+ processCode: string;
13
+ businessKey: string;
14
+ transferPrepare?: Record<string, any> | null;
15
+ }>>> & Readonly<{
16
+ onSuccess?: (() => any) | undefined;
17
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
@@ -0,0 +1,22 @@
1
+ /** 审批流程日志(入参 process_code + business_key,按节点返回 users) */
2
+ export declare const APPROVAL_FLOW_LOGS_URL = "/workhome-app/index/approvalInstance/flowLogs";
3
+ /** 审批实例列表(取 status / transfer_prepare / return_prepare / add_sign_prepare / can_cancel,决定底部按钮显隐) */
4
+ export declare const APPROVAL_INSTANCE_LIST_URL = "/workhome-app/index/approvalInstance/list";
5
+ /** 审核:通过 approved / 驳回 rejected(意见必填) */
6
+ export declare const APPROVAL_AUDIT_URL = "/workhome-app/index/approvalInstance/audit";
7
+ /** 转审前置校验(can_transfer、mode=self|proxy、pending_handlers) */
8
+ export declare const APPROVAL_TRANSFER_PREPARE_URL = "/workhome-app/index/approvalInstance/transferPrepare";
9
+ /** 转审提交(transfer_user,管理员代转需带 task_id) */
10
+ export declare const APPROVAL_TRANSFER_URL = "/workhome-app/index/approvalInstance/transfer";
11
+ /** 回退前置校验(can_return、上一节点 prev_node_name、pending_handlers) */
12
+ export declare const APPROVAL_RETURN_PREPARE_URL = "/workhome-app/index/approvalInstance/returnPrepare";
13
+ /** 回退至上一审批节点(本人回退 comment 必填,代退需 task_id) */
14
+ export declare const APPROVAL_RETURN_URL = "/workhome-app/index/approvalInstance/returnPrevious";
15
+ /** 加签前置校验(can_add_sign、current_node_name、exclude_users) */
16
+ export declare const APPROVAL_ADD_SIGN_PREPARE_URL = "/workhome-app/index/approvalInstance/addSignPrepare";
17
+ /** 当前节点加签(add_sign_user,代加签需 task_id) */
18
+ export declare const APPROVAL_ADD_SIGN_URL = "/workhome-app/index/approvalInstance/addSign";
19
+ /** 取消审批(发起人或有权限时终止流程) */
20
+ export declare const APPROVAL_CANCEL_URL = "/workhome-app/index/approvalInstance/cancel";
21
+ /** 转审/加签选人(用户列表 username + name) */
22
+ export declare const APPROVAL_USER_LIST_URL = "/rms-app/comm/user/list";
@@ -0,0 +1,2 @@
1
+ export { default as JApprovalFlow } from './JApprovalFlow';
2
+ export { APPROVAL_FLOW_LOGS_URL, APPROVAL_AUDIT_URL, APPROVAL_INSTANCE_LIST_URL, } from './apiPaths';
@@ -0,0 +1,7 @@
1
+ export declare const isOkFlag: (value: unknown) => value is true | 1 | "1" | "true";
2
+ export declare function useApprovalHttp(): (config: {
3
+ url: string;
4
+ method?: string;
5
+ data?: any;
6
+ params?: any;
7
+ }) => Promise<any>;
@@ -10,7 +10,7 @@
10
10
  * WMS 可直接用 wmsDocDetailComponents 作为 components。
11
11
  */
12
12
  export type { DocDetailType, DocDetailAdapters, DocDetailRegistryItem, DocDetailComponents, CreateDocDetailOptions, DocDetailViewOptions, PurchaseOrderTabName, } from './types';
13
- export { createDocDetail, registerDocDetail, getDocDetailRegistry, getDocDetailAdapters, getDocDetailViewOptions, getDocDetailEntry, isDocDetailInitialized, } from './registry';
13
+ export { createDocDetail, registerDocDetail, getDocDetailRegistry, getDocDetailAdapters, getDocDetailViewOptions, getApprovalProcessCode, hasApprovalFlow, getDocDetailEntry, isDocDetailInitialized, } from './registry';
14
14
  export { useDocDetailStore } from './store';
15
15
  export { provideDocRequest, setDocRequest, getDocRequest } from './request';
16
16
  export type { JDocRequestFn } from './request';
@@ -19,6 +19,8 @@ export declare function registerDocDetail(options: Partial<CreateDocDetailOption
19
19
  export declare function getDocDetailRegistry(): NormalizedRegistry;
20
20
  export declare function getDocDetailAdapters(): DocDetailAdapters;
21
21
  export declare function getDocDetailViewOptions(): DocDetailViewOptions;
22
+ export declare function getApprovalProcessCode(type: string): string;
23
+ export declare function hasApprovalFlow(type: string): boolean;
22
24
  export declare function isDocDetailInitialized(): boolean;
23
25
  export declare function getDocDetailEntry(type: string): {
24
26
  component: Component;
@@ -14,7 +14,7 @@ export declare const useDocDetailStore: StoreDefinition<"jgyDocDetail", Pick<{
14
14
  open: (docType: DocDetailType, no: string) => Promise<void>;
15
15
  close: () => void;
16
16
  reset: () => void;
17
- }, "type" | "orderNo" | "visible">, Pick<{
17
+ }, "type" | "visible" | "orderNo">, Pick<{
18
18
  visible: Ref<boolean, boolean>;
19
19
  type: Ref<string, string>;
20
20
  orderNo: Ref<string, string>;
@@ -123,6 +123,11 @@ export type DocDetailViewOptions = {
123
123
  purchase?: {
124
124
  tabOrder?: PurchaseOrderTabName[];
125
125
  };
126
+ /**
127
+ * 单据 type → 审批流程编码。有非空编码才展示右侧审批列,否则单列铺满。
128
+ * 会与库内默认值合并;传空字符串可关掉某类单据的审批列。
129
+ */
130
+ approvalProcessCodes?: Record<string, string>;
126
131
  };
127
132
  export type CreateDocDetailOptions = {
128
133
  /** type → 详情组件 */
@@ -0,0 +1,120 @@
1
+ import { JImportDone, JImportHeader, JImportMode, JImportResult } from './types';
2
+ import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+
4
+ declare const _default: DefineComponent<ExtractPropTypes<{
5
+ modelValue: PropType<boolean>;
6
+ title: {
7
+ type: PropType<string>;
8
+ default: string;
9
+ };
10
+ headers: {
11
+ type: PropType<JImportHeader[]>;
12
+ default: () => never[];
13
+ };
14
+ moduleName: {
15
+ type: PropType<string>;
16
+ default: string;
17
+ };
18
+ getHeadersApi: {
19
+ type: PropType<() => Promise<unknown>>;
20
+ };
21
+ downloadTemplateApi: {
22
+ type: PropType<() => Promise<unknown>>;
23
+ };
24
+ importApi: {
25
+ type: PropType<(data: FormData) => Promise<unknown>>;
26
+ };
27
+ modes: {
28
+ type: PropType<JImportMode[]>;
29
+ default: () => string[];
30
+ };
31
+ maxSizeMb: {
32
+ type: PropType<number>;
33
+ default: number;
34
+ };
35
+ maxRows: {
36
+ type: PropType<number>;
37
+ default: number;
38
+ };
39
+ maxCols: {
40
+ type: PropType<number>;
41
+ default: number;
42
+ };
43
+ templateFileName: {
44
+ type: PropType<string>;
45
+ default: string;
46
+ };
47
+ }>, {
48
+ setResult: JImportDone;
49
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
50
+ close: () => void;
51
+ success: (result: JImportResult) => void;
52
+ import: (payload: {
53
+ mode: JImportMode;
54
+ file: File;
55
+ fileName: string;
56
+ rows: Record<string, unknown>[];
57
+ }, done: JImportDone) => void;
58
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
59
+ modelValue: PropType<boolean>;
60
+ title: {
61
+ type: PropType<string>;
62
+ default: string;
63
+ };
64
+ headers: {
65
+ type: PropType<JImportHeader[]>;
66
+ default: () => never[];
67
+ };
68
+ moduleName: {
69
+ type: PropType<string>;
70
+ default: string;
71
+ };
72
+ getHeadersApi: {
73
+ type: PropType<() => Promise<unknown>>;
74
+ };
75
+ downloadTemplateApi: {
76
+ type: PropType<() => Promise<unknown>>;
77
+ };
78
+ importApi: {
79
+ type: PropType<(data: FormData) => Promise<unknown>>;
80
+ };
81
+ modes: {
82
+ type: PropType<JImportMode[]>;
83
+ default: () => string[];
84
+ };
85
+ maxSizeMb: {
86
+ type: PropType<number>;
87
+ default: number;
88
+ };
89
+ maxRows: {
90
+ type: PropType<number>;
91
+ default: number;
92
+ };
93
+ maxCols: {
94
+ type: PropType<number>;
95
+ default: number;
96
+ };
97
+ templateFileName: {
98
+ type: PropType<string>;
99
+ default: string;
100
+ };
101
+ }>> & Readonly<{
102
+ onClose?: (() => any) | undefined;
103
+ onSuccess?: ((result: JImportResult) => any) | undefined;
104
+ onImport?: ((payload: {
105
+ mode: JImportMode;
106
+ file: File;
107
+ fileName: string;
108
+ rows: Record<string, unknown>[];
109
+ }, done: JImportDone) => any) | undefined;
110
+ }>, {
111
+ title: string;
112
+ headers: JImportHeader[];
113
+ moduleName: string;
114
+ modes: JImportMode[];
115
+ maxSizeMb: number;
116
+ maxRows: number;
117
+ maxCols: number;
118
+ templateFileName: string;
119
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
120
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as JImportData } from './JImportData';
2
+ export type { JImportDataProps, JImportDataEmits, JImportHeader, JImportMode, JImportPayload, JImportResult, JImportDone, JImportGetHeadersApi, JImportDownloadTemplateApi, JImportApi, } from './types';
@@ -0,0 +1,65 @@
1
+ /** 导入模式:仅新增 / 仅更新 / 新增和更新 */
2
+ export type JImportMode = 'insert' | 'update' | 'upsert';
3
+ /** 标准模板列:label 为 Excel 表头,prop 为解析后对象字段 */
4
+ export interface JImportHeader {
5
+ label: string;
6
+ prop: string;
7
+ required?: boolean;
8
+ }
9
+ export interface JImportPayload {
10
+ mode: JImportMode;
11
+ /** 原始上传文件,业务侧可直接 FormData 提交 */
12
+ file: File;
13
+ fileName: string;
14
+ /** 仅在传入 headers / getHeadersApi 时前端解析;否则为空数组 */
15
+ rows: Record<string, unknown>[];
16
+ }
17
+ export interface JImportResult {
18
+ successCount: number;
19
+ failCount: number;
20
+ skipCount: number;
21
+ failUrl?: string;
22
+ skipUrl?: string;
23
+ successUrl?: string;
24
+ /** code === 1 时展示全成功页,否则有 data 时展示失败/未处理页 */
25
+ fullSuccess?: boolean;
26
+ failRows?: Record<string, unknown>[];
27
+ skipRows?: Record<string, unknown>[];
28
+ /** 有值时停留在填写态并提示,不切结果页 */
29
+ errorMessage?: string;
30
+ }
31
+ export type JImportDone = (result: JImportResult) => void;
32
+ export type JImportGetHeadersApi = () => Promise<unknown>;
33
+ /** 下载标准模板:返回 Blob,或 { data: Blob }(如 responseType: 'blob' 的 axios 响应) */
34
+ export type JImportDownloadTemplateApi = () => Promise<unknown>;
35
+ /** 点击导入:传入 FormData(file + import_mode),与业务页 importXxx(formData) 一致 */
36
+ export type JImportApi = (data: FormData) => Promise<unknown>;
37
+ export interface JImportDataProps {
38
+ /** 弹窗标题 */
39
+ title?: string;
40
+ /** 用于模板 / 失败 / 未处理文件名 */
41
+ moduleName?: string;
42
+ /** 可选。传入后会在前端按表头解析 rows;不传则只保留文件 */
43
+ headers?: JImportHeader[];
44
+ /** 可选。打开弹窗时拉取表头(headers 为空才请求) */
45
+ getHeadersApi?: JImportGetHeadersApi;
46
+ /** 从后端下载标准模板,不传则「标准模板」不可点 */
47
+ downloadTemplateApi?: JImportDownloadTemplateApi;
48
+ /** 点击导入时请求的接口,不传则走 @import 事件 */
49
+ importApi?: JImportApi;
50
+ /** 可选导入模式,默认三种都有 */
51
+ modes?: JImportMode[];
52
+ /** 文件大小上限 MB */
53
+ maxSizeMb?: number;
54
+ /** 数据行上限(不含表头) */
55
+ maxRows?: number;
56
+ /** 列数上限 */
57
+ maxCols?: number;
58
+ /** 标准模板保存的文件名,默认 `${moduleName}导入模板.xlsx` */
59
+ templateFileName?: string;
60
+ }
61
+ export interface JImportDataEmits {
62
+ import: [payload: JImportPayload, done: JImportDone];
63
+ success: [result: JImportResult];
64
+ close: [];
65
+ }
@@ -0,0 +1,49 @@
1
+ import { JImportHeader, JImportResult } from './types';
2
+
3
+ export declare function unwrapHeaders(res: unknown): JImportHeader[];
4
+ export declare function formatStamp(date?: Date): string;
5
+ export interface JImportPreviewColumn {
6
+ key: string;
7
+ label: string;
8
+ }
9
+ export interface JImportPreviewSheet {
10
+ name: string;
11
+ columns: JImportPreviewColumn[];
12
+ rows: Record<string, string>[];
13
+ }
14
+ /** 点击文件名时在弹窗内预览,避免浏览器把 xlsx 当下载 */
15
+ export declare function previewImportFile(file: File, maxPreviewRows?: number): Promise<{
16
+ sheets: JImportPreviewSheet[];
17
+ error?: string;
18
+ }>;
19
+ export declare function parseImportFile(file: File, headers: JImportHeader[], limits: {
20
+ maxRows: number;
21
+ maxCols: number;
22
+ }): Promise<{
23
+ rows: Record<string, unknown>[];
24
+ error?: string;
25
+ }>;
26
+ /** 取出接口返回的 Blob:兼容直接返回 Blob 或 { data: Blob } */
27
+ export declare function unwrapBlob(res: unknown): Blob | null;
28
+ /** responseType 为 blob 时,后端报错会以 JSON Blob 返回,读出其中的 msg */
29
+ export declare function readBlobError(blob: Blob): Promise<string | null>;
30
+ export declare function saveBlob(blob: Blob, fileName: string): void;
31
+ export declare function downloadResultExcel(options: {
32
+ headers: JImportHeader[];
33
+ rows: Record<string, unknown>[];
34
+ reasonKeys: string[];
35
+ reasonLabel: string;
36
+ fileName: string;
37
+ }): void;
38
+ export declare function emptyResult(): JImportResult;
39
+ /** 点击结果页链接,直接打开接口返回的 Excel 地址 */
40
+ export declare function openExcelUrl(url: string): void;
41
+ /**
42
+ * 解析导入接口:
43
+ * code === 1 → 全成功
44
+ * code !== 1 且有 data → 失败/未处理结果页
45
+ * data: { success: { count, url }, fail: { count, url }, unprocessed: { count, url } }
46
+ */
47
+ export declare function parseImportApiResponse(res: unknown): JImportResult;
48
+ /** 拦截器 reject 时若挂了 raw,从中解析导入结果 */
49
+ export declare function parseImportApiError(error: unknown): JImportResult;
@@ -6,14 +6,14 @@ declare const _default: DefineComponent<ExtractPropTypes<{
6
6
  type: PropType<string>;
7
7
  default: string;
8
8
  };
9
- getFieldListApi: {
10
- type: PropType<ApiFn>;
11
- required: true;
12
- };
13
9
  importApi: {
14
10
  type: PropType<(data: Record<string, any>[]) => Promise<any>>;
15
11
  required: true;
16
12
  };
13
+ getFieldListApi: {
14
+ type: PropType<ApiFn>;
15
+ required: true;
16
+ };
17
17
  excludeFields: {
18
18
  type: PropType<string[]>;
19
19
  default: () => string[];
@@ -26,14 +26,14 @@ declare const _default: DefineComponent<ExtractPropTypes<{
26
26
  type: PropType<string>;
27
27
  default: string;
28
28
  };
29
- getFieldListApi: {
30
- type: PropType<ApiFn>;
31
- required: true;
32
- };
33
29
  importApi: {
34
30
  type: PropType<(data: Record<string, any>[]) => Promise<any>>;
35
31
  required: true;
36
32
  };
33
+ getFieldListApi: {
34
+ type: PropType<ApiFn>;
35
+ required: true;
36
+ };
37
37
  excludeFields: {
38
38
  type: PropType<string[]>;
39
39
  default: () => string[];
@@ -21,8 +21,8 @@ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VL
21
21
  type: "sku" | "spu";
22
22
  code: string;
23
23
  id: number | string;
24
- request: JProductRequestFn;
25
24
  visible: boolean;
25
+ request: JProductRequestFn;
26
26
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
27
27
  export default _default;
28
28
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -69,8 +69,8 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
69
69
  clearSelected: () => void;
70
70
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
71
71
  open: () => void;
72
- closed: () => void;
73
72
  confirm: (rows: Row[]) => void;
73
+ closed: () => void;
74
74
  }, string, PublicProps, Readonly< ExtractPropTypes<{
75
75
  modelValue: PropType<boolean>;
76
76
  title: {
@@ -124,8 +124,8 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
124
124
  };
125
125
  }>> & Readonly<{
126
126
  onOpen?: (() => any) | undefined;
127
- onClosed?: (() => any) | undefined;
128
127
  onConfirm?: ((rows: Row[]) => any) | undefined;
128
+ onClosed?: (() => any) | undefined;
129
129
  }>, {
130
130
  title: string;
131
131
  width: string;
@@ -12,6 +12,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
12
12
  type: PropType<string>;
13
13
  default: string;
14
14
  };
15
+ rows: {
16
+ type: PropType<number>;
17
+ default: number;
18
+ };
15
19
  options: {
16
20
  type: PropType<SearchInputOption[]>;
17
21
  default: () => never[];
@@ -32,10 +36,6 @@ declare const _default: DefineComponent<ExtractPropTypes<{
32
36
  type: PropType<string | number>;
33
37
  default: string;
34
38
  };
35
- rows: {
36
- type: PropType<number>;
37
- default: number;
38
- };
39
39
  textareaPlaceholder: {
40
40
  type: PropType<string>;
41
41
  default: string;
@@ -62,6 +62,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
62
62
  type: PropType<string>;
63
63
  default: string;
64
64
  };
65
+ rows: {
66
+ type: PropType<number>;
67
+ default: number;
68
+ };
65
69
  options: {
66
70
  type: PropType<SearchInputOption[]>;
67
71
  default: () => never[];
@@ -82,10 +86,6 @@ declare const _default: DefineComponent<ExtractPropTypes<{
82
86
  type: PropType<string | number>;
83
87
  default: string;
84
88
  };
85
- rows: {
86
- type: PropType<number>;
87
- default: number;
88
- };
89
89
  textareaPlaceholder: {
90
90
  type: PropType<string>;
91
91
  default: string;
@@ -100,12 +100,12 @@ declare const _default: DefineComponent<ExtractPropTypes<{
100
100
  }>, {
101
101
  placeholder: string;
102
102
  width: string;
103
+ rows: number;
103
104
  options: SearchInputOption[];
104
105
  selectWidth: string;
105
106
  separator: string;
106
107
  dialogTitle: string;
107
108
  dialogWidth: string | number;
108
- rows: number;
109
109
  textareaPlaceholder: string;
110
110
  clearOnTypeChange: boolean;
111
111
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,5 @@
1
+ import { Directive } from 'vue';
2
+
3
+ export type ClickLockValue = number | boolean | undefined;
4
+ export declare const vClickLock: Directive<HTMLElement, ClickLockValue>;
5
+ export default vClickLock;
@@ -0,0 +1,2 @@
1
+ export { vClickLock } from './clickLock';
2
+ export type { ClickLockValue } from './clickLock';