@partex/one-core 1.0.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/README.md +591 -0
- package/lib/components/auth/index.d.ts +1 -0
- package/lib/components/auth/index.vue.d.ts +3 -0
- package/lib/components/back/index.d.ts +1 -0
- package/lib/components/back/index.vue.d.ts +17 -0
- package/lib/components/common.d.ts +100 -0
- package/lib/components/components.d.ts +17 -0
- package/lib/components/create.d.ts +16 -0
- package/lib/components/dashboard/index.d.ts +1 -0
- package/lib/components/dashboard/store.d.ts +6 -0
- package/lib/components/error404/index.d.ts +1 -0
- package/lib/components/error404/index.vue.d.ts +5 -0
- package/lib/components/error500/index.d.ts +1 -0
- package/lib/components/error500/index.vue.d.ts +5 -0
- package/lib/components/footer/index.d.ts +1 -0
- package/lib/components/footer/index.vue.d.ts +15 -0
- package/lib/components/header/api.d.ts +44 -0
- package/lib/components/header/index.d.ts +4 -0
- package/lib/components/header/index.vue.d.ts +114 -0
- package/lib/components/header/interface.d.ts +14 -0
- package/lib/components/header/message.vue.d.ts +51 -0
- package/lib/components/header/pop.vue.d.ts +53 -0
- package/lib/components/header/store.d.ts +20 -0
- package/lib/components/icon.d.ts +17 -0
- package/lib/components/importer/api.d.ts +21 -0
- package/lib/components/importer/index.d.ts +1 -0
- package/lib/components/importer/index.vue.d.ts +115 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/local/en-US.d.ts +89 -0
- package/lib/components/local/index.d.ts +175 -0
- package/lib/components/local/zh-CN.d.ts +88 -0
- package/lib/components/login/api.d.ts +7 -0
- package/lib/components/login/index.d.ts +3 -0
- package/lib/components/login/index.vue.d.ts +76 -0
- package/lib/components/login/interface.d.ts +49 -0
- package/lib/components/login/store.d.ts +47 -0
- package/lib/components/logo/index.d.ts +1 -0
- package/lib/components/logo/index.vue.d.ts +18 -0
- package/lib/components/my/api.d.ts +3 -0
- package/lib/components/my/index.d.ts +1 -0
- package/lib/components/my/index.vue.d.ts +30 -0
- package/lib/components/my/interface.d.ts +14 -0
- package/lib/components/numberRoll/index.d.ts +1 -0
- package/lib/components/numberRoll/index.vue.d.ts +47 -0
- package/lib/components/preset.d.ts +5 -0
- package/lib/components/report/api.d.ts +1 -0
- package/lib/components/report/index.d.ts +1 -0
- package/lib/components/report/index.vue.d.ts +9 -0
- package/lib/components/searchBar/index.d.ts +2 -0
- package/lib/components/searchBar/index.vue.d.ts +74 -0
- package/lib/components/searchBar/interface.d.ts +76 -0
- package/lib/components/searchBar/item.vue.d.ts +63 -0
- package/lib/components/skeleton/index.d.ts +1 -0
- package/lib/components/skeleton/index.vue.d.ts +24 -0
- package/lib/components/table/index.d.ts +1 -0
- package/lib/components/table/index.vue.d.ts +158 -0
- package/lib/index.d.ts +1 -0
- package/lib/one-core.cjs +1 -0
- package/lib/one-core.js +4982 -0
- package/lib/one-core.umd.cjs +1 -0
- package/lib/style.css +1 -0
- package/package.json +77 -0
- package/volar.d.ts +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
# 公共组件
|
|
2
|
+
## oc-search-bar
|
|
3
|
+
* value 搜索的默认值 Object default: {}
|
|
4
|
+
* data 搜索列表 ISearchBarType default: {}
|
|
5
|
+
* loading? 加载状态 Boolean default: false
|
|
6
|
+
* cols? 显示的栅格数量 number default: 5
|
|
7
|
+
* on-update:value? 值更新时执行的回调 default: undefined
|
|
8
|
+
|
|
9
|
+
* slot header
|
|
10
|
+
* slot left
|
|
11
|
+
* slot action
|
|
12
|
+
|
|
13
|
+
* ts
|
|
14
|
+
* ISearchBarType
|
|
15
|
+
```
|
|
16
|
+
type: 'input' | 'number' | 'select' | 'dropdown' | 'cascader' | 'treeSelect' | 'datePicker'
|
|
17
|
+
|
|
18
|
+
// base
|
|
19
|
+
show?: boolean // 是否显示
|
|
20
|
+
clearable?: boolean //是否可清除
|
|
21
|
+
placeholder?: string // 占位字符
|
|
22
|
+
updateValue?: (value: [] | string | number | null, data: any) => void // 值更新回调
|
|
23
|
+
|
|
24
|
+
// number
|
|
25
|
+
min?: number // 最小值
|
|
26
|
+
max?: number // 最大值
|
|
27
|
+
step?: number // 步进
|
|
28
|
+
showButton?: boolean // 是否显示步进按钮
|
|
29
|
+
suffix?: string // 前缀
|
|
30
|
+
validator?: (value: number) => boolean // 自定义验证
|
|
31
|
+
|
|
32
|
+
// select
|
|
33
|
+
multiple?: boolean // 是否多选
|
|
34
|
+
options: Array<SelectOption | SelectGroupOption> | any
|
|
35
|
+
|
|
36
|
+
// dropdown
|
|
37
|
+
options: SelectOption[] | any
|
|
38
|
+
|
|
39
|
+
// cascader
|
|
40
|
+
multiple?: boolean // 是否多选
|
|
41
|
+
checkStrategy?: 'all' | 'parent' | 'child' // 选中模式
|
|
42
|
+
options: CascaderOption[] | any
|
|
43
|
+
|
|
44
|
+
// treeSelect
|
|
45
|
+
multiple?: boolean // 是否多选
|
|
46
|
+
checkStrategy?: 'all' | 'parent' | 'child' // 选中模式
|
|
47
|
+
options: TreeSelectOption[] | any
|
|
48
|
+
|
|
49
|
+
// datePicker
|
|
50
|
+
dateType:
|
|
51
|
+
| 'date'
|
|
52
|
+
| 'datetime'
|
|
53
|
+
| 'daterange'
|
|
54
|
+
| 'datetimerange'
|
|
55
|
+
| 'month'
|
|
56
|
+
| 'monthrange'
|
|
57
|
+
| 'year'
|
|
58
|
+
| 'quarter'
|
|
59
|
+
format?: string // 格式化
|
|
60
|
+
isDateDisabled?: (current: number) => boolean // 禁用时间
|
|
61
|
+
shortcuts?:
|
|
62
|
+
| Record<string, number | (() => number)>
|
|
63
|
+
| Record<string, [number, number] | (() => [number, number])>
|
|
64
|
+
|
|
65
|
+
// Group
|
|
66
|
+
type: 'group'
|
|
67
|
+
options: Array<SelectOption | SelectGroupOption>
|
|
68
|
+
input: GInput | GInputNumber | GDatePicker | GSelectPicker
|
|
69
|
+
width?: number | string
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
<oc-search-bar
|
|
74
|
+
:loading="loading"
|
|
75
|
+
:value="search"
|
|
76
|
+
:data="items"
|
|
77
|
+
:cols="5"
|
|
78
|
+
@on-update:value="submit"
|
|
79
|
+
>
|
|
80
|
+
<template #header></template>
|
|
81
|
+
<template #left></template>
|
|
82
|
+
<template #action></template>
|
|
83
|
+
</oc-search-bar>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## oc-back
|
|
87
|
+
* 一个返回按钮
|
|
88
|
+
* 参数 to?: string 默认情况返回上一级历史
|
|
89
|
+
```
|
|
90
|
+
<oc-back />
|
|
91
|
+
<oc-back to="/home" />
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## oc-footer
|
|
95
|
+
* 公共页尾
|
|
96
|
+
* 参数 version?: string 可显示本项目的版本信息
|
|
97
|
+
```
|
|
98
|
+
<oc-footer version="2.1.0" />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## oc-header
|
|
102
|
+
* 公共页头
|
|
103
|
+
* 参数 menuOptions: Array<MenuOption | MenuDividerOption | MenuGroupOption>
|
|
104
|
+
* ts: IHeaderMenu
|
|
105
|
+
```
|
|
106
|
+
<oc-header :menuOptions="menu" />
|
|
107
|
+
const menu = ref<Array<MenuOption | MenuDividerOption | MenuGroupOption>>([
|
|
108
|
+
{
|
|
109
|
+
label: '首页',
|
|
110
|
+
key: '/iot/home',
|
|
111
|
+
icon: () => h(Tv),
|
|
112
|
+
children: [
|
|
113
|
+
{
|
|
114
|
+
label: '大屏1',
|
|
115
|
+
key: '/iot/home'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: '大屏2',
|
|
119
|
+
key: '/iot/performance'
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
])
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## oc-importer
|
|
127
|
+
* 公共excel导入组件
|
|
128
|
+
* 参数
|
|
129
|
+
* show: boolean 显示/隐藏
|
|
130
|
+
* type: string 后台需要的导入key
|
|
131
|
+
* file: string 模版下载地址
|
|
132
|
+
* steam?: boolean 是否需要下载流
|
|
133
|
+
* update:show? 显示/隐藏改变回调
|
|
134
|
+
```
|
|
135
|
+
<oc-importer
|
|
136
|
+
v-model:show="showModal"
|
|
137
|
+
type="task"
|
|
138
|
+
file="https://xxx-cloud-test.oss-cn-xxx.aliyuncs.com/xxxx.xlsx"
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
* 同时提供公共下载方法
|
|
142
|
+
* fnDownload(params)
|
|
143
|
+
* params
|
|
144
|
+
```
|
|
145
|
+
{
|
|
146
|
+
[key: string]: any
|
|
147
|
+
jobTypeName?: string
|
|
148
|
+
jobParams?: string
|
|
149
|
+
file?: File
|
|
150
|
+
query?: Query
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
* 建议写法
|
|
154
|
+
```
|
|
155
|
+
<n-tooltip trigger="hover">
|
|
156
|
+
<template #trigger>
|
|
157
|
+
<n-popconfirm
|
|
158
|
+
positive-text="导出"
|
|
159
|
+
placement="bottom-end"
|
|
160
|
+
@positive-click="exportData"
|
|
161
|
+
>
|
|
162
|
+
<template #trigger>
|
|
163
|
+
<n-button :loading="downloading">
|
|
164
|
+
<template #icon>
|
|
165
|
+
<n-icon>
|
|
166
|
+
<IconCloudArrowDown />
|
|
167
|
+
</n-icon>
|
|
168
|
+
</template>
|
|
169
|
+
</n-button>
|
|
170
|
+
</template>
|
|
171
|
+
导出工序?
|
|
172
|
+
</n-popconfirm>
|
|
173
|
+
</template>
|
|
174
|
+
导出工序
|
|
175
|
+
</n-tooltip>
|
|
176
|
+
|
|
177
|
+
import { fnDownload } from '@partex/one-core'
|
|
178
|
+
const exportData = (): void => {
|
|
179
|
+
downloading.value = true
|
|
180
|
+
fnDownload({
|
|
181
|
+
jobTypeName: 'process',
|
|
182
|
+
query: query.value
|
|
183
|
+
})
|
|
184
|
+
.then(() => {
|
|
185
|
+
notice.success({
|
|
186
|
+
content: '操作成功',
|
|
187
|
+
duration: 3000
|
|
188
|
+
})
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
downloading.value = false
|
|
191
|
+
}, 2000)
|
|
192
|
+
})
|
|
193
|
+
.catch(() => {
|
|
194
|
+
notice.error({
|
|
195
|
+
content: '操作失败,请重试',
|
|
196
|
+
duration: 3000
|
|
197
|
+
})
|
|
198
|
+
downloading.value = false
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## oc-logo
|
|
204
|
+
* 大屏顶部logo显示
|
|
205
|
+
* 参数 text?: string 顶部文字
|
|
206
|
+
```
|
|
207
|
+
<oc-logo text="智能刀具管理平台" />
|
|
208
|
+
```
|
|
209
|
+
## oc-my
|
|
210
|
+
* 个人信息页面
|
|
211
|
+
```
|
|
212
|
+
<oc-my />
|
|
213
|
+
```
|
|
214
|
+
## oc-number-roll
|
|
215
|
+
* 数字滚动效果
|
|
216
|
+
* 参数
|
|
217
|
+
* value: number | string
|
|
218
|
+
* duration?: number 持续时长
|
|
219
|
+
* precision?: number 精度
|
|
220
|
+
* format?: Fn<number, string> 格式化
|
|
221
|
+
```
|
|
222
|
+
<oc-number-roll
|
|
223
|
+
:value="count ?? 0"
|
|
224
|
+
:format="numFormat"
|
|
225
|
+
/>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## oc-skeleton
|
|
229
|
+
* 骨架屏
|
|
230
|
+
* 参数
|
|
231
|
+
* cols?: number 一排几个,最大24
|
|
232
|
+
* num?: [number, number][] 每行每列的数量
|
|
233
|
+
```
|
|
234
|
+
<oc-skeleton
|
|
235
|
+
:cols="3"
|
|
236
|
+
:num="[
|
|
237
|
+
[3, 1],
|
|
238
|
+
[3, 1],
|
|
239
|
+
[3, 1]
|
|
240
|
+
]"
|
|
241
|
+
/>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## oc-404
|
|
245
|
+
* 页面未找到
|
|
246
|
+
```
|
|
247
|
+
<oc-404 />
|
|
248
|
+
```
|
|
249
|
+
## oc-500
|
|
250
|
+
* 发生错误
|
|
251
|
+
```
|
|
252
|
+
<oc-500 />
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
# 公共方法
|
|
256
|
+
|
|
257
|
+
## fnIsMobile
|
|
258
|
+
* 获取界面宽度是否小于等于568 返回boolean isMobile: true
|
|
259
|
+
## fnSetStorage
|
|
260
|
+
* 保存进LocalStorage
|
|
261
|
+
* key: string
|
|
262
|
+
* value: string | ObjectKey | boolean,
|
|
263
|
+
* expired: number | string = 30000 // 存储时间 string接受 '1 Minutes' '5 Hours' '7 Day' '1 Week'
|
|
264
|
+
* 0 为永久存储
|
|
265
|
+
```
|
|
266
|
+
fnSetStorage('save', {a: 1}, 0)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## fnGetStorage
|
|
270
|
+
* 取LocalStorage
|
|
271
|
+
* key: string
|
|
272
|
+
* defaultValue: any 当过期或不存在时返回默认值
|
|
273
|
+
```
|
|
274
|
+
fnGetStorage('save', false)
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## fnDelStorage
|
|
278
|
+
* 删除LocalStorage
|
|
279
|
+
* key: string
|
|
280
|
+
|
|
281
|
+
## fnScrollTop
|
|
282
|
+
* 移动页面到顶部
|
|
283
|
+
|
|
284
|
+
## fnDeleteLoad
|
|
285
|
+
* 删除加载中状态
|
|
286
|
+
|
|
287
|
+
## fnPageModel2Naive
|
|
288
|
+
* 转换NUI的query到后台的query
|
|
289
|
+
|
|
290
|
+
## fnPageNaive2Model
|
|
291
|
+
* 转换后台的query到NUI的query
|
|
292
|
+
|
|
293
|
+
## fnFormatTime
|
|
294
|
+
* 格式化时间
|
|
295
|
+
* value: string | number | Date | null | undefined,
|
|
296
|
+
* fmt = 'yyyy-MM-dd'
|
|
297
|
+
* yyyy-MM-dd hh:mm:ss
|
|
298
|
+
|
|
299
|
+
## fnRenderAction
|
|
300
|
+
* 公用操作按钮方法
|
|
301
|
+
* buttons: IActionButton[]
|
|
302
|
+
* type: 'detail' | 'edit' | 'delete' | 'tips' | 'custom'
|
|
303
|
+
* disabled?: false
|
|
304
|
+
```
|
|
305
|
+
{
|
|
306
|
+
type: 'detail',
|
|
307
|
+
onClick: () => detail(row)
|
|
308
|
+
}
|
|
309
|
+
{
|
|
310
|
+
type: 'edit',
|
|
311
|
+
onClick: () => edit(row)
|
|
312
|
+
}
|
|
313
|
+
{
|
|
314
|
+
type: 'delete',
|
|
315
|
+
onClick: () => delete(row)
|
|
316
|
+
}
|
|
317
|
+
{
|
|
318
|
+
type: 'tips',
|
|
319
|
+
onClick: () => tips(row)
|
|
320
|
+
}
|
|
321
|
+
{
|
|
322
|
+
type: 'custom',
|
|
323
|
+
onClick: () => {
|
|
324
|
+
exportData(row.key)
|
|
325
|
+
},
|
|
326
|
+
icon: IconCalendarArrowDown,
|
|
327
|
+
color: 'success',
|
|
328
|
+
text: '下载'
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## fnEncodeCursor
|
|
333
|
+
* 加密到base64
|
|
334
|
+
* data: ObjectKey
|
|
335
|
+
|
|
336
|
+
## fnDecodeCursor
|
|
337
|
+
* 解密base64
|
|
338
|
+
* data: string
|
|
339
|
+
|
|
340
|
+
## fnThrottle
|
|
341
|
+
* 节流方法
|
|
342
|
+
```
|
|
343
|
+
const svgTitle = fnThrottle((e: MouseEvent): void => {
|
|
344
|
+
const tmp = (e.target as HTMLBaseElement).dataset.title
|
|
345
|
+
title.value = tmp || ''
|
|
346
|
+
}, 200)
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## fnFullScreen
|
|
350
|
+
* 全屏显示
|
|
351
|
+
* element: any // 要全屏的元素
|
|
352
|
+
* callback?: Fn // 回调函数
|
|
353
|
+
|
|
354
|
+
## GET
|
|
355
|
+
* 全局统一fetch的GET方法
|
|
356
|
+
* url: string
|
|
357
|
+
* data: any
|
|
358
|
+
* responseType?: "arraybuffer" | "blob" | "document" | "json" | "stream" | "text"
|
|
359
|
+
|
|
360
|
+
## POST
|
|
361
|
+
* 全局统一fetch的POST方法
|
|
362
|
+
* url: string
|
|
363
|
+
* data: ObjectKey
|
|
364
|
+
* responseType?: "arraybuffer" | "blob" | "document" | "json" | "stream" | "text"
|
|
365
|
+
* timeout?: number
|
|
366
|
+
## FILE
|
|
367
|
+
* 全局统一fetch的FILE方法
|
|
368
|
+
* url: string
|
|
369
|
+
* data: any
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
import { POST } from '@partex/one-core'
|
|
373
|
+
GET('api/manager/prod-task/page', params)
|
|
374
|
+
POST('api/manager/prod-task/page', params)
|
|
375
|
+
FILE('api/manager/job/submit', formData)
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
# 公共Store
|
|
379
|
+
* headerStore
|
|
380
|
+
```
|
|
381
|
+
interface Store {
|
|
382
|
+
download: boolean // 显示/隐藏下载窗口
|
|
383
|
+
theme: boolean // 主题颜色 true: light false: dark
|
|
384
|
+
platformName: string // 平台名称
|
|
385
|
+
platformType: string // 平台代码
|
|
386
|
+
platformUrl: string // 平台首页
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
* fnSetTheme(boolean) 设置主题
|
|
390
|
+
* fnSetPlatform 设置平台
|
|
391
|
+
```
|
|
392
|
+
fnSetPlatform({
|
|
393
|
+
platformName: ''
|
|
394
|
+
platformType: ''
|
|
395
|
+
platformUrl: ''
|
|
396
|
+
})
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## userStore
|
|
400
|
+
* 用户信息
|
|
401
|
+
```
|
|
402
|
+
factoryId?: string
|
|
403
|
+
userId?: string
|
|
404
|
+
thirdUserId?: string
|
|
405
|
+
email: string
|
|
406
|
+
password: string
|
|
407
|
+
name: string
|
|
408
|
+
realName: string
|
|
409
|
+
phone: string
|
|
410
|
+
description: string
|
|
411
|
+
enable: boolean
|
|
412
|
+
oeeStatus: 0 | 1 // OEE状态
|
|
413
|
+
tenantName: string // 租户名称
|
|
414
|
+
kind: number // -1开发者 0普通账户 1大屏账户 2虚拟账号 99管理员
|
|
415
|
+
roleId: 1 | 2
|
|
416
|
+
authorizationGroupArray: string[]
|
|
417
|
+
authorizationMachineArray: string[]
|
|
418
|
+
iot_menu_authorization: string[]
|
|
419
|
+
tdm_menu_authorization: string[]
|
|
420
|
+
info: IUserInfo
|
|
421
|
+
endTime: number
|
|
422
|
+
tenantStatus: 0 | 1 | 2
|
|
423
|
+
renewalStatus: 0 | 1
|
|
424
|
+
ncFlg: 0 | 1 // NC代码权限
|
|
425
|
+
systemType: 0 | 1 | 2 // 基础版:Basic;高级版:Premium;旗舰版:Flagship
|
|
426
|
+
platform_tdm: boolean
|
|
427
|
+
```
|
|
428
|
+
* fnSetUser 设置用户信息
|
|
429
|
+
* fnGetUser 通过接口获取用户信息
|
|
430
|
+
* fnClearUser 清除用户信息
|
|
431
|
+
* fnUserLogout 退出登录
|
|
432
|
+
|
|
433
|
+
## scaleStore
|
|
434
|
+
* 縮放比例
|
|
435
|
+
```
|
|
436
|
+
scale: number
|
|
437
|
+
```
|
|
438
|
+
* fnComputedScale 計算縮放
|
|
439
|
+
* fnListenerScale 監聽縮放,返回remove
|
|
440
|
+
* fnSetNormalWidthAndHeight 修改NormalWidthAndHeight 默认4k 16:9
|
|
441
|
+
|
|
442
|
+
# 导出公共ts
|
|
443
|
+
```
|
|
444
|
+
export interface Query {
|
|
445
|
+
page: number
|
|
446
|
+
pageSize?: number
|
|
447
|
+
pageCount?: number
|
|
448
|
+
itemCount?: number
|
|
449
|
+
pageSizes?: number[]
|
|
450
|
+
isGetAll?: 0 | 1
|
|
451
|
+
keyword?: string
|
|
452
|
+
columnKey?: string
|
|
453
|
+
order?: string
|
|
454
|
+
showQuickJumper?: boolean
|
|
455
|
+
showSizePicker?: boolean
|
|
456
|
+
pageSlot?: number
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export interface PageModel<T> {
|
|
460
|
+
current: string
|
|
461
|
+
size: string
|
|
462
|
+
pages: string
|
|
463
|
+
total: string
|
|
464
|
+
records: T
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export interface PageRecords<T> {
|
|
468
|
+
query: Query
|
|
469
|
+
records: T
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export interface Fn<T = any, R = T> {
|
|
473
|
+
(...arg: T[]): R
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export type ObjectKey<T = any> = {
|
|
477
|
+
[x in string | number]: T
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export type Recordable<T = any> = Record<string, T>
|
|
481
|
+
|
|
482
|
+
export type Nullable<T> = T | null
|
|
483
|
+
|
|
484
|
+
export type Mapped<Type> = {
|
|
485
|
+
[Properties in keyof Type as KeyType]: Type[Properties]
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export type TimeoutHandle = ReturnType<typeof setTimeout> | undefined
|
|
489
|
+
|
|
490
|
+
export type IntervalHandle = ReturnType<typeof setInterval> | undefined
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## ICON
|
|
494
|
+
* IconChevronLeft
|
|
495
|
+
* IconArrowSquareDown
|
|
496
|
+
* IconWeatherMoon
|
|
497
|
+
* IconWeatherSunny
|
|
498
|
+
* IconGridDots
|
|
499
|
+
* IconSearch
|
|
500
|
+
* IconArrowClockwise
|
|
501
|
+
* IconCalendarArrowDown
|
|
502
|
+
* IconFullScreenMaximize
|
|
503
|
+
* IconDelete
|
|
504
|
+
* IconEye
|
|
505
|
+
* IconDrafts
|
|
506
|
+
* IconDismiss
|
|
507
|
+
* IconMailInboxAdd
|
|
508
|
+
* IconCloudArrowDown
|
|
509
|
+
|
|
510
|
+
## root Colors
|
|
511
|
+
```
|
|
512
|
+
--primary: 142, 84, 200;
|
|
513
|
+
--white: 255, 255, 255;
|
|
514
|
+
--card: 255, 255, 255;
|
|
515
|
+
--font: 51, 51, 51;
|
|
516
|
+
--bg: 247, 248, 250;
|
|
517
|
+
--input: 255, 255, 255;
|
|
518
|
+
--border: 224, 224, 230;
|
|
519
|
+
--green: 93, 174, 87;
|
|
520
|
+
--yellow: 240, 151, 58;
|
|
521
|
+
--red: 230, 84, 68;
|
|
522
|
+
--blue: 32, 128, 240;
|
|
523
|
+
--grey: 175, 175, 175;
|
|
524
|
+
--cardShadow: 0 6px 10px -5px rgba(0, 0, 0, 0.1);
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
# 未加入,视情况以后加入
|
|
528
|
+
## useThrottleFn
|
|
529
|
+
* 用来处理节流函数的 Hook。
|
|
530
|
+
* 频繁调用 run,但只会每隔 500ms 执行一次相关函数。
|
|
531
|
+
```
|
|
532
|
+
<template>
|
|
533
|
+
<div>
|
|
534
|
+
<p style="marginTop: 16"> Clicked count: {{throttleFnValue}} </p>
|
|
535
|
+
<button type="button" @click="run">
|
|
536
|
+
useThrottleFn测试
|
|
537
|
+
</button>
|
|
538
|
+
</div>
|
|
539
|
+
</template>
|
|
540
|
+
|
|
541
|
+
<script lang="ts">
|
|
542
|
+
import { ref } from 'vue';
|
|
543
|
+
import { useThrottleFn } from 'one-core';
|
|
544
|
+
|
|
545
|
+
export default {
|
|
546
|
+
setup() {
|
|
547
|
+
const throttleFnValue = ref(1);
|
|
548
|
+
const { run } = useThrottleFn(()=>{
|
|
549
|
+
throttleFnValue.value++
|
|
550
|
+
},500)
|
|
551
|
+
|
|
552
|
+
return {
|
|
553
|
+
throttleFnValue,
|
|
554
|
+
run,
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
</script>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
## useDebounceFn
|
|
562
|
+
* 用来处理防抖函数的 Hook
|
|
563
|
+
* 频繁调用 debounceFnRun,但只会在所有点击完成 1000ms 后执行一次相关函数
|
|
564
|
+
```
|
|
565
|
+
<template>
|
|
566
|
+
<div>
|
|
567
|
+
<p style="marginTop: 16"> Clicked count: {{debounceFnValue}} </p>
|
|
568
|
+
<button type="button" @click="debounceFnRun">
|
|
569
|
+
useDebounceFn测试
|
|
570
|
+
</button>
|
|
571
|
+
</div>
|
|
572
|
+
</template>
|
|
573
|
+
|
|
574
|
+
<script lang="ts">
|
|
575
|
+
import { ref } from 'vue';
|
|
576
|
+
import { useDebounceFn } from 'one-core';
|
|
577
|
+
export default {
|
|
578
|
+
setup() {
|
|
579
|
+
const debounceFnValue = ref<number>(1);
|
|
580
|
+
const { run:debounceFnRun } = useDebounceFn(()=>{
|
|
581
|
+
debounceFnValue.value++
|
|
582
|
+
},500)
|
|
583
|
+
|
|
584
|
+
return {
|
|
585
|
+
debounceFnValue,
|
|
586
|
+
debounceFnRun,
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
</script>
|
|
591
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OcAuth } from './index.vue';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<{}>>, {}, {}>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OcBack } from './index.vue';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{
|
|
3
|
+
to: {
|
|
4
|
+
type: PropType<string>;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
back: () => void;
|
|
9
|
+
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<{
|
|
10
|
+
to: {
|
|
11
|
+
type: PropType<string>;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}>>, {
|
|
15
|
+
to: string;
|
|
16
|
+
}, {}>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { BuiltInGlobalTheme } from 'naive-ui/es/themes/interface';
|
|
2
|
+
import type { GlobalThemeOverrides, PaginationInfo } from 'naive-ui';
|
|
3
|
+
import { VNodeChild } from 'vue';
|
|
4
|
+
export { fnCancelFetch } from '../utils/fetch';
|
|
5
|
+
export interface Query {
|
|
6
|
+
page: number;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
pageCount?: number;
|
|
9
|
+
itemCount?: number;
|
|
10
|
+
pageSizes?: number[];
|
|
11
|
+
isGetAll?: 0 | 1;
|
|
12
|
+
keyword?: string;
|
|
13
|
+
columnKey?: string;
|
|
14
|
+
order?: string;
|
|
15
|
+
showQuickJumper?: boolean;
|
|
16
|
+
showSizePicker?: boolean;
|
|
17
|
+
pageSlot?: number;
|
|
18
|
+
sorter?: ObjectKey;
|
|
19
|
+
prefix?: (info: PaginationInfo) => VNodeChild;
|
|
20
|
+
suffix?: (info: PaginationInfo) => VNodeChild;
|
|
21
|
+
}
|
|
22
|
+
export interface PageModel<T> {
|
|
23
|
+
current: string;
|
|
24
|
+
size: string;
|
|
25
|
+
pages: string;
|
|
26
|
+
total: string;
|
|
27
|
+
records: T;
|
|
28
|
+
}
|
|
29
|
+
export interface PageRecords<T> {
|
|
30
|
+
query: Query;
|
|
31
|
+
records: T;
|
|
32
|
+
}
|
|
33
|
+
export interface Fetch<T = any> {
|
|
34
|
+
(url: string, data?: any, responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'stream' | 'text', timeout?: number): Promise<T>;
|
|
35
|
+
}
|
|
36
|
+
export interface Fn<T = any, R = T> {
|
|
37
|
+
(...arg: T[]): R;
|
|
38
|
+
}
|
|
39
|
+
export type ObjectKey<T = any> = {
|
|
40
|
+
[x in string | number]: T;
|
|
41
|
+
};
|
|
42
|
+
export type Recordable<T = any> = Record<string, T>;
|
|
43
|
+
export type Nullable<T> = T | null;
|
|
44
|
+
export type Mapped<Type> = {
|
|
45
|
+
[Properties in keyof Type as KeyType]: Type[Properties];
|
|
46
|
+
};
|
|
47
|
+
export type TimeoutHandle = ReturnType<typeof setTimeout> | undefined;
|
|
48
|
+
export type IntervalHandle = ReturnType<typeof setInterval> | undefined;
|
|
49
|
+
export type IActionButton = {
|
|
50
|
+
type: 'detail' | 'edit' | 'delete';
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
loading?: boolean;
|
|
53
|
+
onClick: Fn;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'custom';
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
onClick: Fn;
|
|
59
|
+
icon?: any;
|
|
60
|
+
color: 'default' | 'tertiary' | 'primary' | 'success' | 'info' | 'warning' | 'error';
|
|
61
|
+
buttonText?: string;
|
|
62
|
+
text: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: 'tips';
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
onClick: Fn;
|
|
68
|
+
icon?: any;
|
|
69
|
+
color: 'default' | 'tertiary' | 'primary' | 'success' | 'info' | 'warning' | 'error';
|
|
70
|
+
buttonText?: string;
|
|
71
|
+
text: string;
|
|
72
|
+
tips: string;
|
|
73
|
+
};
|
|
74
|
+
export declare const lightTheme: GlobalThemeOverrides;
|
|
75
|
+
export declare const darkTheme: BuiltInGlobalTheme;
|
|
76
|
+
export declare function fnIsMobile(): boolean;
|
|
77
|
+
export declare function fnSetStorage(key: string, value: string | ObjectKey | boolean, expired?: number | string): void;
|
|
78
|
+
export declare function fnGetStorage(key: string, defaultValue: any): any;
|
|
79
|
+
export declare const fnDelStorage: (key: string) => void;
|
|
80
|
+
export declare const fnScrollTop: (value?: number) => void;
|
|
81
|
+
export declare const fnDeleteLoad: () => void;
|
|
82
|
+
export declare function fnPageModel2Naive<T>(value: PageModel<T>, key?: boolean): PageRecords<T>;
|
|
83
|
+
export declare function fnPageNaive2Model(value: {
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
query?: Query;
|
|
86
|
+
}): ObjectKey;
|
|
87
|
+
export declare const fnFormatTime: (value: string | number | Date | null | undefined, fmt?: string) => string;
|
|
88
|
+
export declare const fnRenderAction: (buttons: IActionButton[]) => VNodeChild;
|
|
89
|
+
export declare const fnEncodeCursor: (data: ObjectKey) => string;
|
|
90
|
+
export declare const fnDecodeCursor: (data: string) => ObjectKey;
|
|
91
|
+
export declare const fnThrottle: (fn: Fn, wait?: number) => Fn;
|
|
92
|
+
export declare function fnFullScreen(element: any, callback?: Fn): void;
|
|
93
|
+
export declare function fnFormatUnits(number: number, precision?: number): string;
|
|
94
|
+
export declare const GET: Fetch;
|
|
95
|
+
export declare const POST: Fetch;
|
|
96
|
+
export declare const FILE: Fetch;
|
|
97
|
+
export declare const fnCheckIoTRole: (role: string) => boolean;
|
|
98
|
+
export declare const fnCheckTDMRole: (role: string) => boolean;
|
|
99
|
+
export declare const fnCheckQMSRole: (role: string) => boolean;
|
|
100
|
+
export declare const fnCheckDashRole: (role: string) => boolean;
|