matrix_components 2.0.380 → 2.0.385
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.
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP请求相关类型定义
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/** 自定义请求配置接口 */
|
|
6
|
+
export interface HttpCustomConfig {
|
|
7
|
+
/** 请求超时时间(毫秒) */
|
|
8
|
+
timeout?: number
|
|
9
|
+
/** Content-Type 类型 */
|
|
10
|
+
contentType?: string
|
|
11
|
+
/** 自定义请求头 */
|
|
12
|
+
headers?: Record<string, string>
|
|
13
|
+
/** 其他axios配置 */
|
|
14
|
+
[key: string]: any
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** HTTP响应数据接口 */
|
|
18
|
+
export interface HttpResponse<T = any> {
|
|
19
|
+
code: number
|
|
20
|
+
data: T
|
|
21
|
+
msg: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 错误响应接口 */
|
|
25
|
+
export interface ErrorResponse {
|
|
26
|
+
code?: number
|
|
27
|
+
response?: any
|
|
28
|
+
message?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 错误回调函数类型 */
|
|
32
|
+
export type ErrorCallback = (error: ErrorResponse, message: string) => void
|
|
33
|
+
|
|
34
|
+
/** 请求方法枚举 */
|
|
35
|
+
export enum RequestMethod {
|
|
36
|
+
GET = 'GET',
|
|
37
|
+
POST = 'POST',
|
|
38
|
+
PUT = 'PUT',
|
|
39
|
+
DELETE = 'DELETE',
|
|
40
|
+
PATCH = 'PATCH'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Content-Type枚举 */
|
|
44
|
+
export enum ContentType {
|
|
45
|
+
JSON = 'application/json',
|
|
46
|
+
FORM_URLENCODED = 'application/x-www-form-urlencoded',
|
|
47
|
+
FORM_DATA = 'multipart/form-data',
|
|
48
|
+
TEXT = 'text/plain',
|
|
49
|
+
HTML = 'text/html'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** GET请求函数类型 */
|
|
53
|
+
export interface GetFunction {
|
|
54
|
+
<T = any>(
|
|
55
|
+
url: string,
|
|
56
|
+
params?: Record<string, any>,
|
|
57
|
+
base?: string,
|
|
58
|
+
customConfig?: HttpCustomConfig,
|
|
59
|
+
errorCallback?: ErrorCallback
|
|
60
|
+
): Promise<T>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** POST请求函数类型 */
|
|
64
|
+
export interface PostFunction {
|
|
65
|
+
<T = any>(
|
|
66
|
+
url: string,
|
|
67
|
+
data?: any,
|
|
68
|
+
base?: string,
|
|
69
|
+
customConfig?: HttpCustomConfig,
|
|
70
|
+
errorCallback?: ErrorCallback
|
|
71
|
+
): Promise<T>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** PUT请求函数类型 */
|
|
75
|
+
export interface PutFunction {
|
|
76
|
+
<T = any>(
|
|
77
|
+
url: string,
|
|
78
|
+
data?: any,
|
|
79
|
+
base?: string,
|
|
80
|
+
customConfig?: HttpCustomConfig,
|
|
81
|
+
errorCallback?: ErrorCallback
|
|
82
|
+
): Promise<T>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** DELETE请求函数类型 */
|
|
86
|
+
export interface DeleteFunction {
|
|
87
|
+
<T = any>(
|
|
88
|
+
url: string,
|
|
89
|
+
data?: any,
|
|
90
|
+
base?: string,
|
|
91
|
+
customConfig?: HttpCustomConfig,
|
|
92
|
+
errorCallback?: ErrorCallback
|
|
93
|
+
): Promise<T>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 下载文件函数类型 */
|
|
97
|
+
export interface DownloadFunction {
|
|
98
|
+
(
|
|
99
|
+
url: string,
|
|
100
|
+
filename?: string,
|
|
101
|
+
method?: string,
|
|
102
|
+
data?: any,
|
|
103
|
+
base?: string,
|
|
104
|
+
customConfig?: HttpCustomConfig,
|
|
105
|
+
errorCallback?: ErrorCallback
|
|
106
|
+
): Promise<any>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** 下载本地文件函数类型 */
|
|
110
|
+
export interface DownloadLocalFileFunction {
|
|
111
|
+
(path: string, name: string, errorCallback?: ErrorCallback): void
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** 获取Token信息函数类型 */
|
|
115
|
+
export interface GetTokenInfoFunction {
|
|
116
|
+
(): Record<string, string>
|
|
117
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// 全局类型定义文件,用于ESLint校验,放开所有限制
|
|
2
|
+
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue'
|
|
5
|
+
const component: DefineComponent<{}, {}, any>
|
|
6
|
+
export default component
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module '*.css' {
|
|
10
|
+
const content: Record<string, string>
|
|
11
|
+
export default content
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.scss' {
|
|
15
|
+
const content: Record<string, string>
|
|
16
|
+
export default content
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.less' {
|
|
20
|
+
const content: Record<string, string>
|
|
21
|
+
export default content
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.json' {
|
|
25
|
+
const content: Record<string, any>
|
|
26
|
+
export default content
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.png' {
|
|
30
|
+
const content: string
|
|
31
|
+
export default content
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.jpg' {
|
|
35
|
+
const content: string
|
|
36
|
+
export default content
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.jpeg' {
|
|
40
|
+
const content: string
|
|
41
|
+
export default content
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare module '*.gif' {
|
|
45
|
+
const content: string
|
|
46
|
+
export default content
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare module '*.svg' {
|
|
50
|
+
const content: string
|
|
51
|
+
export default content
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module '*.ico' {
|
|
55
|
+
const content: string
|
|
56
|
+
export default content
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare module '*.woff' {
|
|
60
|
+
const content: string
|
|
61
|
+
export default content
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare module '*.woff2' {
|
|
65
|
+
const content: string
|
|
66
|
+
export default content
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare module '*.ttf' {
|
|
70
|
+
const content: string
|
|
71
|
+
export default content
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare module '*.eot' {
|
|
75
|
+
const content: string
|
|
76
|
+
export default content
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare module '*.wasm' {
|
|
80
|
+
const content: any
|
|
81
|
+
export default content
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 引用HTTP请求相关类型定义
|
|
85
|
+
// 注意:这些类型已在 packages/api/types.d.ts 中详细定义
|
|
86
|
+
|
|
87
|
+
// 矩阵组件库类型声明
|
|
88
|
+
declare module 'matrix_components' {
|
|
89
|
+
import type { App } from 'vue'
|
|
90
|
+
|
|
91
|
+
const components: {
|
|
92
|
+
NsVideo: any
|
|
93
|
+
NsExcel: any
|
|
94
|
+
NsPdf: any
|
|
95
|
+
NsWord: any
|
|
96
|
+
NsOffice: any
|
|
97
|
+
NsForm: any
|
|
98
|
+
NsFormTitle: any
|
|
99
|
+
NsSaturationline: any
|
|
100
|
+
NsImage: any
|
|
101
|
+
NsImg: any
|
|
102
|
+
NsMD: any
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const install: (app: App, params?: any) => void
|
|
106
|
+
|
|
107
|
+
const NsDialog: any
|
|
108
|
+
|
|
109
|
+
const sacle_x: any
|
|
110
|
+
const sacle_y: any
|
|
111
|
+
const autoScaleInit: any
|
|
112
|
+
|
|
113
|
+
const loadAccess: any
|
|
114
|
+
const removeDynamicAccess: any
|
|
115
|
+
|
|
116
|
+
const getEncryptSm2: any
|
|
117
|
+
|
|
118
|
+
/** GET请求函数 */
|
|
119
|
+
const get: <T = any>(
|
|
120
|
+
url: string,
|
|
121
|
+
params?: Record<string, any>,
|
|
122
|
+
base?: string,
|
|
123
|
+
customConfig?: HttpCustomConfig,
|
|
124
|
+
errorCallback?: ErrorCallback
|
|
125
|
+
) => Promise<T>
|
|
126
|
+
|
|
127
|
+
/** POST请求函数 */
|
|
128
|
+
const post: <T = any>(
|
|
129
|
+
url: string,
|
|
130
|
+
data?: any,
|
|
131
|
+
base?: string,
|
|
132
|
+
customConfig?: HttpCustomConfig,
|
|
133
|
+
errorCallback?: ErrorCallback
|
|
134
|
+
) => Promise<T>
|
|
135
|
+
|
|
136
|
+
/** PUT请求函数 */
|
|
137
|
+
const put: <T = any>(
|
|
138
|
+
url: string,
|
|
139
|
+
data?: any,
|
|
140
|
+
base?: string,
|
|
141
|
+
customConfig?: HttpCustomConfig,
|
|
142
|
+
errorCallback?: ErrorCallback
|
|
143
|
+
) => Promise<T>
|
|
144
|
+
|
|
145
|
+
/** DELETE请求函数 */
|
|
146
|
+
const del: <T = any>(
|
|
147
|
+
url: string,
|
|
148
|
+
data?: any,
|
|
149
|
+
base?: string,
|
|
150
|
+
customConfig?: HttpCustomConfig,
|
|
151
|
+
errorCallback?: ErrorCallback
|
|
152
|
+
) => Promise<T>
|
|
153
|
+
|
|
154
|
+
/** 下载文件函数 */
|
|
155
|
+
const download: (
|
|
156
|
+
url: string,
|
|
157
|
+
filename?: string,
|
|
158
|
+
method?: string,
|
|
159
|
+
data?: any,
|
|
160
|
+
base?: string,
|
|
161
|
+
customConfig?: HttpCustomConfig,
|
|
162
|
+
errorCallback?: ErrorCallback
|
|
163
|
+
) => Promise<any>
|
|
164
|
+
|
|
165
|
+
/** 下载本地文件函数 */
|
|
166
|
+
const downLoadLocalFile: (
|
|
167
|
+
path: string,
|
|
168
|
+
name: string,
|
|
169
|
+
errorCallback?: ErrorCallback
|
|
170
|
+
) => void
|
|
171
|
+
|
|
172
|
+
/** 获取Token信息函数 */
|
|
173
|
+
const getTokenInfo: () => Record<string, string>
|
|
174
|
+
|
|
175
|
+
export default {
|
|
176
|
+
install,
|
|
177
|
+
...components
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export {
|
|
181
|
+
install,
|
|
182
|
+
components,
|
|
183
|
+
NsDialog,
|
|
184
|
+
sacle_x,
|
|
185
|
+
sacle_y,
|
|
186
|
+
autoScaleInit,
|
|
187
|
+
loadAccess,
|
|
188
|
+
removeDynamicAccess,
|
|
189
|
+
getEncryptSm2,
|
|
190
|
+
post,
|
|
191
|
+
get,
|
|
192
|
+
put,
|
|
193
|
+
del,
|
|
194
|
+
download,
|
|
195
|
+
downLoadLocalFile,
|
|
196
|
+
getTokenInfo,
|
|
197
|
+
NsVideo,
|
|
198
|
+
NsExcel,
|
|
199
|
+
NsPdf,
|
|
200
|
+
NsWord,
|
|
201
|
+
NsOffice,
|
|
202
|
+
NsForm,
|
|
203
|
+
NsFormTitle,
|
|
204
|
+
NsSaturationline,
|
|
205
|
+
NsImage,
|
|
206
|
+
NsImg,
|
|
207
|
+
NsMD
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 声明全局变量
|
|
212
|
+
declare global {
|
|
213
|
+
interface Window {
|
|
214
|
+
[key: string]: any
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface NodeRequire {
|
|
218
|
+
context: any
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const process: {
|
|
222
|
+
env: {
|
|
223
|
+
[key: string]: string | undefined
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// 允许使用任意类型
|
|
229
|
+
declare type AnyType = any
|